package middleware

import (
	"github.com/gogf/gf/net/ghttp"
	userService "websshop/app/service/user"
)

// 鉴权中间件，只有登录成功之后才能通过
func Auth(r *ghttp.Request) {
	if userService.IsLogin(r.Session,"Admin") {
		r.Middleware.Next()
	} else {
		//r.Response.WriteStatus(http.StatusMovedPermanently)
		userService.RedirectUrl(r.Response,"/admin/user/login")
	}
}

